package com.member.shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizRaffleActivityPrize;
import com.member.shop.mapper.SysBizRaffleActivityPrizeMapper;
import com.member.shop.service.ISysBizRaffleActivityPrizeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 抽奖活动奖品对应关系Service业务层处理
 *
 * @author thomas
 * @date 2024-03-15
 */
@Service
public class SysBizRaffleActivityPrizeServiceImpl extends ServiceImpl<SysBizRaffleActivityPrizeMapper, SysBizRaffleActivityPrize> implements ISysBizRaffleActivityPrizeService {
    @Resource
    private SysBizRaffleActivityPrizeMapper sysBizRaffleActivityPrizeMapper;

    /**
     * 查询抽奖活动奖品对应关系
     *
     * @param id 抽奖活动奖品对应关系主键
     * @return 抽奖活动奖品对应关系
     */
    @Override
    public SysBizRaffleActivityPrize selectSysBizRaffleActivityPrizeById(Long id) {
        return sysBizRaffleActivityPrizeMapper.selectById(id);
    }

    /**
     * 查询抽奖活动奖品对应关系列表
     *
     * @param queryWrapper 抽奖活动奖品对应关系
     * @return 抽奖活动奖品对应关系
     */
    @Override
    public List<SysBizRaffleActivityPrize> selectSysBizRaffleActivityPrizeList(SysBizRaffleActivityPrize queryWrapper) {
        return sysBizRaffleActivityPrizeMapper.selectSysBizRaffleActivityPrizeList(queryWrapper);
    }

    /**
     * 新增抽奖活动奖品对应关系
     *
     * @param sysBizRaffleActivityPrize 抽奖活动奖品对应关系
     * @return 结果
     */
    @Override
    public int insertSysBizRaffleActivityPrize(SysBizRaffleActivityPrize sysBizRaffleActivityPrize) {
        sysBizRaffleActivityPrize.setCreateTime(DateUtils.getNowDate());
        return sysBizRaffleActivityPrizeMapper.insert(sysBizRaffleActivityPrize);
    }

    /**
     * 修改抽奖活动奖品对应关系
     *
     * @param sysBizRaffleActivityPrize 抽奖活动奖品对应关系
     * @return 结果
     */
    @Override
    public int updateSysBizRaffleActivityPrize(SysBizRaffleActivityPrize sysBizRaffleActivityPrize) {
        sysBizRaffleActivityPrize.setUpdateTime(DateUtils.getNowDate());
        return sysBizRaffleActivityPrizeMapper.updateById(sysBizRaffleActivityPrize);
    }

    /**
     * 批量删除抽奖活动奖品对应关系
     *
     * @param ids 需要删除的抽奖活动奖品对应关系主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRaffleActivityPrizeByIds(Long[] ids) {
        return sysBizRaffleActivityPrizeMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除抽奖活动奖品对应关系信息
     *
     * @param id 抽奖活动奖品对应关系主键
     * @return 结果
     */
    @Override
    public int deleteSysBizRaffleActivityPrizeById(Long id) {
        return sysBizRaffleActivityPrizeMapper.deleteById(id);
    }
}
